package com.zzyk.main.mapper;

import com.zzyk.main.model.pojo.DeviceType;
import com.zzyk.main.model.vo.DeviceTypeVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface DeviceTypeMapper {
    /**
     * delete by primary key
     *
     * @param id primaryKey
     * @return deleteCount
     */
    int deleteByPrimaryKey(Integer id);

    /**
     * insert record to table
     *
     * @param record the record
     * @return insert count
     */
    int insert(DeviceType record);

    /**
     * insert record to table selective
     *
     * @param record the record
     * @return insert count
     */
    int insertSelective(DeviceType record);

    /**
     * select by primary key
     *
     * @param id primary key
     * @return object by primary key
     */
    DeviceType selectByPrimaryKey(Integer id);

    /**
     * update record selective
     *
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKeySelective(DeviceType record);

    /**
     * update record
     *
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKey(DeviceType record);

    List<DeviceTypeVO> selectDeviceTypeTree();

    List<DeviceTypeVO> selectDeviceTypeTreeByParentId(@Param("id") Integer id);

    List<DeviceType> selectByParentId(@Param("parentId") Integer parentId);

    String selectTitleById(@Param("id") Integer id);

    List<DeviceType> selectAllByRank(@Param("rank") Integer rank);

    DeviceType selectAllByTitle(@Param("title") String title);

    List<DeviceType> selectAllByUser(@Param("enterprise") Integer enterprise, @Param("deviceList") Integer[] deviceList);
}